package com.order.mapper;

import com.usian.order.Order;
import com.usian.order.Order_Take;
import com.usian.order.TravelRequest;
import com.usian.travelSchedule.TravelSchedule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface TravelRequestMapper {
    @Select("   SELECT * FROM travel_schedule WHERE designer_id = #{id} or designer_id is null")

    List<TravelSchedule> selectTravelRequest(Integer id);

    @Select("SELECT * FROM itinerary WHERE id = #{itineraryId} or designer_id IS NUll")

    TravelRequest selectItinerary(Integer itineraryId);


    @Select("SELECT * FROM tb_order WHERE user_id = #{userId} and address_id = #{addressId} and status = 1")
    Order selectTravelOrderStatus(int userId, Integer addressId);
    @Select("SELECT * FROM travel_schedule WHERE designer_id IS NULL")
    List<TravelSchedule> selectlookupTravelRequest();
    @Select("SELECT * FROM tb_order WHERE user_id = #{userId} and order_status =#{id} and address_id =#{ids}")
    List<Order> selectTravelOrderStatuslookup(Integer userId, Integer id,Integer ids);
    @Select("SELECT * FROM tb_order WHERE user_id = #{userId} and order_status =99")
    Order selectTravelOrderStatuslook(Integer userId);
    @Select("SELECT * FROM tb_order WHERE address_id = #{id}")
    Order selectOrder(Integer id);
    @Select("SELECT * FROM travel_schedule WHERE id = #{addressId}")
    TravelSchedule selectTravel(Integer addressId);
    @Update("UPDATE travel_schedule SET designer_id = #{userid} WHERE id = #{id}")
    int UptravelSchedule(Integer id,Integer userid);
    @Update("UPDATE tb_order SET order_status = 2 WHERE id = #{id}")
    void upOrderStatus(Integer id);
}
